home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / dbase / vpi1manl.zip / PRTMANL.PRG < prev   
Text File  |  1990-04-11  |  4KB  |  115 lines

  1. *** PRTMANL.PRG ***
  2. **  An actual working version of a demonstration program
  3. **     provided by  SUB ROSA PUBLISHING INC.
  4. **
  5. **  Purpose: produce a printable version of the SR-Info/VP-Info Manual
  6. **           for people who don't have an IBM character-set
  7. **
  8. **
  9. **  PRTMANL demonstrates the use of sequential file functions to produce
  10. **  an altered copy of given file.
  11. **
  12. **  PRTMANL is compatable with all current versions of SR-Info and VP-Info.
  13. **
  14. **  Bernie Melman and Sid Bursten
  15. **  April 1,1990
  16. ***************************************************************************
  17. SET raw on                   ;no extra space between print fields
  18. * initialize variables
  19. DIM char 1 matrix[256]
  20. infile=blank(15)
  21. standard=' '
  22. WINDOW                        ; get rid on any window left open.
  23. ERASE                         ; clear screen
  24. * set up input screen - note that all variables used have been initialized
  25. * .. lines are picture clauses forcing upper case for infile and standard
  26. TEXT
  27. .. infile   !!!!!!!!!!!!!!!
  28. .. standard !
  29.           This program will automatically print the manual provided
  30.           to you on disk without any printer control codes other than
  31.           carriage returm line feed and eject.
  32.  
  33.           If your printer does not support the standard IBM Proprinter
  34.           character set, but does handle the standard Epson MX/FX
  35.           series graphics characters, it substitutes box and rule
  36.           characters appropriately.
  37.  
  38.           If your printer supports neither of these character sets,
  39.           all graphics characters will be converted to vertical
  40.           and horizontal broken lines, with plus signs at the borders
  41.           of boxes.
  42.  
  43.           It works properly on PC-Info and PC-Info manuals on disk,
  44.           but may not work for other input files.
  45.  
  46.       ┌───────────────────────────────────────────────────────────────────┐
  47.       │   Name of file to convert and print: @infile                      │
  48.       │───────────────────────────────────────────────────────────────────│
  49.       │   Printer supports (I)BM, (E)pson, or (N)o graphics (I/E/N)? %standard    │
  50.       └───────────────────────────────────────────────────────────────────┘
  51. ENDTEXT
  52. ON field
  53. FIELD infile
  54.    IF file(infile)                 ;file found
  55.       ERASE 0,0
  56.    ELSE
  57.       RING
  58.       @ 0,0 say trim(!(infile))+' not found. Press any key'
  59.       ok=inkey()
  60.    ENDIF
  61. FIELD standard
  62.    IF @(standard,'NIE')>0          ;entry okay
  63.       ERASE 0,0
  64.    ELSE
  65.       RING
  66.       @ 0,0 say 'Improper entry. Use I, E or N only. Press any key'
  67.       ok=inkey()
  68.    ENDIF
  69. ENDON
  70. READ
  71. CLS
  72. IF ropen(infile); don't even try if files won't open
  73.    SET print on
  74.    IF standard='I'
  75.       DO WHILE read(newline)    ;if no conversion, route straight to printer
  76.          ? newline
  77.       ENDDO
  78.    ELSE
  79.       IF standard='E'           ;convert to epson graphics
  80. *                               ;sorry, codes unavailable
  81.       ELSE                      ;no graphics suported
  82.          matrix[179]='|'
  83.          REPEAT 39 times varying pos
  84.             matrix[179+pos]='+'
  85.          ENDREPEAT              ;all values outside range 179-218 blank
  86.          matrix[186]='|'
  87.          matrix[196]='-'
  88.          matrix[206]='-'
  89.       ENDIF
  90.       DO WHILE read(newline)    ;start of main loop
  91. * test based on fact that any line with graphics starts with graphic
  92.          IF ltrim(newline)>'}'
  93.             ?                   ;goto new line on printer
  94.             REPEAT len(newline) times varying pos
  95.                ch=substr(newline,pos,1)
  96.                IF ch>'{'
  97.                   ch=matrix[asc(ch)]
  98.                ENDIF
  99.                ?? ch
  100.             ENDREPEAT
  101.          ELSE
  102.             ? newline
  103.          ENDIF
  104.       ENDDO ; end of main loop
  105.       EJECT
  106.       SET print off
  107.       ok=close(1)                ;close the input file,
  108.    ENDIF
  109. ELSE
  110.    ? "Unable to open input file :"+infile
  111. ENDIF
  112. *
  113. *** end of PRTMANL.PRG ***
  114.  
  115.